import { post, get } from './http'

// 图片上传
export const uplaodImg = (paylaod: any) => {
  return post('/product/upload/uploadImage', paylaod, { headers: { 'Content-Type': 'multipart/form-data' } })
}
// 获取所有站点 /user/v1/shop/getShopMarketAll
export const getShopMarketAll = () => {
  return get('/user/v1/shop/getShopMarketAll')
}

// 文件上传
export const upload = (paylaod: any) => {
  return post('/user/v1/file/uploadFile', paylaod, { headers: { 'Content-Type': 'multipart/form-data' } })
}
// 文件上传
export const uploadFile = (paylaod: any) => {
  return post('/product/upload/uploadFile', paylaod, { headers: { 'Content-Type': 'multipart/form-data' } })
}

// 文件上传--无权限
export const uploadFileNoAuth = (paylaod: any) => {
  return post('/product/upload/uploadFileNoAuth', paylaod, { headers: { 'Content-Type': 'multipart/form-data' } })
}

// 根据公司名字查询公司信息
export const getCompanyByName = (paylaod: any) => {
  return get('/user/v1/company/getCompanyByName', paylaod)
}
// pdf链接转文件流
export const pdfToBlob = async (url: string, paylaod?: any) => {
  return await get(url, paylaod, { responseType: 'blob' })
    .then((res) => res)
    .catch(() => false)
}
